


import unittest
import sys
import os
from pylab import *
sys.path.append( os.getcwd() )
from intensbombeocc import *
from pozonoperm import *
from datetime import *
import cProfile

def profileParametrosAcLibre():
  # Custodio Libre - Pagina 683
  r = 10
  t = [10, 30, 50, 100, 300, 1000, 10000]
  ti = []
  s = [0.024, 0.18, 0.31, 0.52, 1.0, 1.38, 2.30]
  Q = 2000
  hi = 5
  for tt in t:
    ti.append(tt/24.0/60.0)
  iCC = IntEnsBombeoCC('L', Q,  r,  ti,  s, h0 = hi)
  iCC.calcParametros()

def profilecalcParametrosAcC():
  # Custodio Confinado
  r = 10
  t = [1,3,6,10,20,40,70,100,200,400,700,1000,2000,3000]
  ti = []
  s = [3.4,4.2,4.8,5.08,5.60,6.05,6.40,6.65,7.10,7.50,7.90,8.25,8.70,8.90]
  Q = 100.0/1000.0*60*60*24.0
  for tt in t:
    ti.append(tt/24.0/60.0)
  iCC = IntEnsBombeoCC('C', Q,  r,  ti,  s)
  di = datetime.now()
  iCC.calcParametros()

def profilecalcParametrosAcSC():
  # Custodio Semiconfinado - Pagina 678
  r = 10
  t = [1,3, 5, 6, 7, 10, 20, 30, 60, 80, 100, 200, 400, 700, 1000]
  ti = []
  s = [2.03, 2.20, 2.22, 2.25, 2.30,2.30,2.30,2.30,2.30,2.30,2.30,2.30,2.30,2.30,2.30]
  Q = 60*60*60*24/1000
  for tt in t:
    ti.append(tt/24.0/60.0)
  iCC = IntEnsBombeoCC('SC', Q,  r,  ti,  s)
  iCC.calcParametros()


#  def testcalcParametros(self):
#    self.iCC.calcParametros()
#    #print "Matriz de transmisividades"
#    #print self.iCC.mT
#    #print "Fin de Matriz de transmisividades"
#    #print "Vector distancia relativas"
#    #print self.iCC.vD
#    #print "Fin Vector distancia relativas"
#    print "Transmisividad"
#    print self.iCC.trans
#    print "Fin Transmisividad"
#    print "Coeficiente almacenamiento"
#    print self.iCC.almac
#    print "Fin Coeficiente almacenamiento"
#    print "Coeficiente almacenamiento"
#    print self.iCC.selrdB
#    print "Fin Coeficiente almacenamiento"
#    text(0.9, 0.9,'IngeSur', color='r',
#    fontsize=10, fontname='Courier',
#    horizontalalignment='center',
#    verticalalignment='center')# ,transform = ax.transAxes,)
#    #TODO: Ver colocar footer con IngeSur srl
#    subplot(211)
#    loglog ( self.iCC.alpha,self.iCC.vD,'.-y',label='Convergencia' )
#    xlabel(r'$S/T(d/m^2)$')
#    ylabel('Distancia relativa de mT')
#    title('Convergencia')
#    grid()
#    subplots_adjust(wspace = 0.4, hspace = 0.4)
#    subplot(212)
#    loglog ( self.iCC.t,self.iCC.s,'or',label='Observado' )
#    loglog ( self.iCC.t,self.iCC.sCalc,'-g',label='Ajustado' )
#    xlabel('t (d)')
#    ylabel('s (m)')
#    title('Ensayo bombeo')
#    grid()
#    import random
#    string = ''
#    for i in range(9):
#      string += random.choice('abcdefghijklmnopqrstuvwxyz0123456789_-ABCDEFGHIJKMLNOPQRSTUVWXYZ')
#    string += ".pdf"
#    string = "/tmp/" + string
#    savefig(string,dpi=(1024/8))


if __name__ == '__main__':
#    print "Acuifero confinado"
#    cProfile.run('profilecalcParametrosAcC()')
#    print "Acuifero libre"
#    cProfile.run('profileParametrosAcLibre()')
    print "Acuifero SC"
    cProfile.run('profilecalcParametrosAcSC()')
